﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Marmat.Forms
{
    public partial class ComboBox
    {
        public class SelectItemCollection : IList<object>
        {
            private List<object> list = new List<object>();

            internal SelectItemCollection()
            {
            }

            public void Add(object item)
            {
                this.list.Add(item);
            }

            public void Clear()
            {
                this.list.Clear();
            }

            public bool Contains(object item)
            {
                return this.list.Contains(item);
            }

            void ICollection<object>.CopyTo(object[] array, int arrayIndex)
            {
            }

            public int Count
            {
                get
                {
                    return this.list.Count;
                }
            }

            bool ICollection<object>.IsReadOnly
            {
                get
                {
                    return false;
                }
            }

            public bool Remove(object item)
            {
                return this.list.Remove(item);
            }

            IEnumerator<object> IEnumerable<object>.GetEnumerator()
            {
                return this.list.GetEnumerator();
            }

            public int IndexOf(object item)
            {
                return this.list.IndexOf(item);
            }

            void IList<object>.Insert(int index, object item)
            {
            }

            public object this[int index]
            {
                get
                {
                    return this.list[index];
                }
                set
                {
                    throw new NotImplementedException();
                }
            }


            void IList<object>.RemoveAt(int index)
            {
                this.list.RemoveAt(index);
            }

            IEnumerator IEnumerable.GetEnumerator()
            {
                return this.list.GetEnumerator();
            }
        }
    }
}